<?php
class YWSHtml {
    public static function localize($name)
    {
        $row = Yii::app()->db->createCommand()
                ->select('value')
                ->from(PortalTranslations::model()->tableName())
                ->where("name='$name'")
                ->queryRow();
        if (!$row) return $name;
        return $row['value'];
    }
    
    public static function SecuredMenu($url, $text, $params = null) {
        $controller = Yii::app()->getController()->getId();
        $action = Yii::app()->getController()->getAction()->getId();
        $module = Yii::app()->getController()->getModule()->getId();
        //hungnv revised this for pass params into secure menu item
        if(isset($params)&&$params!=null)
        {
        $str = "<li><a href='".Yii::app()->createUrl($url,$params)."' title=''>".$text."</a></li>";
        }
        else 
        $str = "<li><a href='".Yii::app()->createUrl($url)."' title=''>".$text."</a></li>";
        return $str;
    }
    
    public static function SecuredMenuHeading($text, $icon = "icon1") {
        $controller = Yii::app()->getController()->getId();
        $action = Yii::app()->getController()->getAction()->getId();
        $module = Yii::app()->getController()->getModule()->getId();
        
        $str = "<a>".$text."<span class='".$icon."'></span></a>";
        
        return $str;
    }
}
?>